package com.go.where.manager.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.go.where.manager.dao.CustomerReportDao;
import com.go.where.manager.page.Pagination;
import com.go.where.manager.pojo.CustomerReportInfo;
import com.go.where.manager.service.CustomerReportService;

@Service("customerReportService")
public class CustomerReportServiceImpl implements CustomerReportService {

	@Resource(name = "customerReportDao")
	private CustomerReportDao customerReportDao;

	@Override
	public CustomerReportInfo queryByPrimartKey(String cid) {
		return customerReportDao.getByKey(cid);
	}

	@Override
	public Pagination<CustomerReportInfo> queryPage(
			CustomerReportInfo customerInfo) {
		Integer count = customerReportDao.totalCount(customerInfo);
		customerInfo.calculate();
		List<CustomerReportInfo> list = customerReportDao
				.queryList(customerInfo);
		Pagination<CustomerReportInfo> page = customerReportDao
				.queryPagination(count, list, customerInfo);
		return page;
	}

	@Override
	public int update(CustomerReportInfo customerInfo) {
		return customerReportDao.update(customerInfo);
	}

}
